package com.qen.truelicense.license;

import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;

/**
 * Looks up the resources for this package in a Resource Bundle.
 * Provided for comfort.
 *
 * @author licz
 * @version 1.0.0
 */
class Resources {

    private static final ResourceBundle resources = ResourceBundle.getBundle("Resources", new Locale("zh", "CN"));
//    private static final ResourceBundle resources = ResourceBundle.getBundle(CLASS_NAME, Locale.SIMPLIFIED_CHINESE);

    /**
     * Looks up a string resource identified by {@code key} in
     * {@code resources}.
     */
    public static String getString(String key) {
        return resources.getString(key);
    }

    /**
     * Looks up a string resource identified by {@code key} in
     * {@code resources} and formats it as a message using
     * {@code MessageFormat.format} with the given {@code arguments}.
     */
    public static String getString(String key, Object[] arguments) {
        return MessageFormat.format(getString(key), arguments);
    }

    /**
     * Looks up a string resource identified by {@code key} in
     * {@code resources} and formats it as a message using
     * {@code MessageFormat.format} with the given singular {@code argument}.
     */
    public static String getString(String key, Object argument) {
        return MessageFormat.format(getString(key), new Object[]{argument});
    }

    /**
     * You cannot instantiate this class.
     */
    protected Resources() {
    }
}
